package com.coolwen.service;

import com.coolwen.dao.UserGroupMapper;
import com.coolwen.entity.UserGroup;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by user on 2016-11-10.
 */
@Service("userGroupService")
public class UserGroupServiceImpl implements UserGroupService {
    @Autowired
    UserGroupMapper userGroupMapper;
    //引入log4j,进行日志打印
    private static final Logger LOGGER = Logger.getLogger(UserGroupServiceImpl.class);


    @Override
    public List<UserGroup> findIdByRequestId(UserGroup record) {
        return userGroupMapper.selectBySelectiveKey(record);
    }

    @Override
    public int deleteByGroupIdAndUserId(UserGroup record) {
        return userGroupMapper.deleteByPrimaryKey(record);
    }

    @Override
    public int addUserGroup(UserGroup userGroup) {
        return userGroupMapper.insertSelective(userGroup);
    }

    @Override
    public Integer getTheNumberGroupJoined(Integer groupId) {
        return userGroupMapper.selectGroupJoinedNumber(groupId);
    }
}
